home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume2
/
kernel
/
whatcpu1.1
< prev
next >
Wrap
Internet Message Format
|
1988-12-28
|
5KB
Path: xanth!nic.MR.NET!hal!cwjcc!mailrus!cornell!rochester!bbn!ulowell!page
From: page@swan.ulowell.edu (Bob Page)
Newsgroups: comp.sources.amiga
Subject: v02i104: whatcpu - check and print cpu type v1.1
Message-ID: <10941@swan.ulowell.edu>
Date: 28 Dec 88 19:23:54 GMT
Organization: University of Lowell, Computer Science Dept.
Lines: 168
Approved: page@swan.ulowell.edu
Submitted-by: erd@cis.ohio-state.edu (Ethan R. Dicks)
Posting-number: Volume 2, Issue 104
Archive-name: kernel/whatcpu11.1
[uuencoded executable included. ..Bob]
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# WhatCPU.asm
# WhatCPU.uu
# This archive created: Wed Dec 28 14:18:14 1988
cat << \SHAR_EOF > WhatCPU.asm
; WhatCPU.asm
;
; Actually a hand conversion of WhatCPU.c by Dave Haynie
; done by Ethan Dicks 14-mar-88
; beautification done by Ethan Dicks 14-Dec-88
;
; I did this as my first project in assembler. Documentation is very
; scanty regarding the use of structures in assembler. I got the magic
; offset into the ExecBase structure for the AttnFlags word by compiling
; Dave Haynie's program with Lattice, on a friend's machine, then
; running omd on the .o file.
;
; V 1.1
; Since I got a copy of the C-A v1.0 Macro Assembler, and the assembler
; includes with Lattice V4.01, I have been able to convert this program
; over to the niceties of INCLUDE files. I also too the opportunity to
; streamline the code to the tune of about 40 bytes, making this one of
; the smallest useful utilities.
;
;
; This program was most recently compiled on:
;
; assem
; MC68000 Macro Assembler Version 10.178
; Copyright (C) 1985 by Tenchstar Ltd., T/A Metacomco.
; All rights reserved.
;
; Blink
; Blink - Version 5.0
; Copyright (c) 1988 Lattice, Inc. All Rights Reserved.
;
;
; To recompile:
; assem WhatCPU.asm -i your_include_directory -o WhatCPU.o
; blink WhatCPU.o
;
; This code is freely redistributable, although not pretty.
;
section code
include "exec/execbase.i"
include "libraries/dos.i"
include "libraries/dos_lib.i"
include "exec/funcdef.i"
include "exec/exec_lib.i"
AbsExecBase equ 4
start: movea.l AbsExecBase,a6 ;save pointer to Execbase in a6
lea dos_name(pc),a1 ;point to library name
moveq.l #0,d0 ;pick any version
jsr _LVOOpenLibrary(a6) ;open dos.library
movea.l d0,a5 ;save DosBase in A5
jsr _LVOOutput(a5) ;get OutputHandle into D0
move.l d0,d5 ;save OutputHandle in D5
;
; print title message
;
move.l #header,d2 ;print intro message
move.l #22,d3 ; 22 chars long
bsr.s print ;output string
;
; check processor type bits
;
btst.b #AFB_68020,AttnFlags+1(a6) ;check 68020 bit
beq.s not68020 ;nope... not set
move.l #mc68020,d2 ;point to "68020"
moveq.l #6,d3 ; 6 chars long
bra.s break ;print processor type and
; check co-processor bit
;
not68020: btst.b #AFB_68010,AttnFlags+1(a6) ;check 68010 bit
beq.s not68010 ;nope... not set
move.l #mc68010,d2 ;point to "68010"
moveq.l #6,d3 ; 6 chars long
bra.s break ;print processor type and
; check co-processor bit
;
not68010: move.l #mc68000,d2 ;must be 68000; print it
moveq.l #6,d3 ; 6 chars long
;print processor type and
; check co-processor bit
;
; *** WARNING ***
;* Fall through *
; ***************
;
break: bsr.s print ;output processor string
btst.b #AFB_68881,AttnFlags+1(a6) ;check 68881 bit
beq.s not68881 ;nope... not set
move.l #mc68881,d2 ;print "68881"
moveq.l #6,d3 ; 6 chars long
bsr.s print
not68881:
;
; print <CR> at end of line
;
move.l #cr,d2 ;finish off with <crlf>
moveq.l #2,d3 ; 2 chars long
bsr.s print
;
; clean up and exit
;
movea.l a5,a1 ;get DosBase
jsr _LVOCloseLibrary(a6) ;close dos.library
moveq.l #0,d0 ;set return code
rts ;go home
;
; subroutines
;
print: move.l d5,d1 ;set output handle
jsr _LVOWrite(a5) ;write string to console
rts ;go back
;
; data section
;
;
; byte aligned data
;
dos_name: DOSNAME
header: dc.b 'System Configuration: '
mc68020: dc.b '68020 '
mc68010: dc.b '68010 '
mc68000: dc.b '68000 '
mc68881: dc.b '68881 '
cr: dc.b 13,10
end
SHAR_EOF
cat << \SHAR_EOF > WhatCPU.uu
begin 777 WhatCPU
M```#\P`````````!```````````````O```#Z0```"\L>``$0_H`>G``3J[])
MV"I`3JW_Q"H`)#P```",)CP````6850(+@`!`2EG"B0\````HG8&8!H(+@``#
M`2EG"B0\````J'8&8`@D/````*YV!F$F""X`!`$I9PHD/````+1V!F$4)#P`2
M``"Z=@)A"B)-3J[^8G``3G4B!4ZM_]!.=61O<RYL:6)R87)Y`%-Y<W1E;2!#@
M;VYF:6=U<F%T:6]N.B`V.#`R,"`V.#`Q,"`V.#`P,"`V.#@X,2`-"@```^P`!
G```&`````````&8```!<````2@```$`````N````&`````````/R-
``
end
size 264
SHAR_EOF
# End of shell archive
exit 0
--
Bob Page, U of Lowell CS Dept. page@swan.ulowell.edu ulowell!page
Have five nice days.